<?php
namespace app\admin\validate;
use think\Validate;

/**
 * 区域信息验证器
 * Created by PhpStorm.
 * User: tyll
 * Date: 2019/09/18
 * Time: 14:47
 */
class Region extends Validate{

    protected $rule = [
        'floorid'  => 'require',
        'name'     => 'require',
        'sort'     => 'require|integer|egt:0',
        'is_cp_ws' => 'require',
        'r_data'   => 'require|array'
    ];

    protected $message = [
        'floorid.require'  => '楼层必须填写',
        'name.require'     => '区域名称必须填写',
        'sort.require'     => '顺序必须填写',
        'sort.integer'     => '顺序填写错误',
        'sort.egt'         => '顺序必须错误',
        'is_cp_ws.require' => '是否巡店工位必须填写',
        'r_data.require'   => '区域必须填写',
        'r_data.array'     => '区域填写错误'
    ];

    protected $scene = [
        'add'  => ['floorid','r_data'],
        'edit' => ['floorid','name','sort','is_cp_ws']
    ];
}